function writeExcelProtection(fileSrcName, fileDstName)
%writeExcelProtection checks to see if checklist can be created.
%   The checklist source and destination are inputs.  The function tries to
%   copy the file, but if it fails, then a question dialog will verify if
%   the Excel file (checklist) is currently open.  If open, it asks the
%   user to close it before going on.  This is a recursive function to
%   ensure it won't error out.
%
%   Inputs: 
%   fileSrcName = file and path of the source checklist
%   fileDstName = file and path of the destination location
%
%   Usage example:
%   writeExcelProtection('path/source file name', 'path/destination file
%   name')
%
%   Notes:
%    

%   

try
    copyfile(fileSrcName, fileDstName, 'f');
    disp('Checklist has been successfully replaced.');
catch
    answer = questdlg('Please close the existing Excel file and select "Continue" or "Cancel" to abort.', ...
        'File override', ...
        'Continue', 'Cancel', 'Cancel');
    if strcmp(answer, 'Continue')
        writeExcelProtection(fileSrcName, fileDstName);
    end
end

end
